package com.qingcloud.fexecutor.base.enums;

/**
 * 部署中心节点使用范围枚举.
 */
public enum DeployUseTypeEnum {

    APP(1, "应用"),
    ORG(2, "组织");

    public final Integer code;
    public final String name;

    DeployUseTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (DeployUseTypeEnum type : DeployUseTypeEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }

    public static DeployUseTypeEnum findByName(String name) {
        for (DeployUseTypeEnum type : DeployUseTypeEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }

}
